package com.prs.crm.service.oa.impl;

import java.io.File;
import java.util.Collection;

import com.prs.crm.context.FileUtil;
import com.prs.crm.dao.oa.OaTaskLogDao;
import com.prs.crm.domain.Attachment;
import com.prs.crm.domain.hr.Person;
import com.prs.crm.domain.oa.OaTaskLog;
import com.prs.crm.domain.oa.OaTaskSubmit;
import com.prs.crm.service.impl.BaseServiceImpl;
import com.prs.crm.service.oa.OaTaskLogService;

public class OaTaskLogServiceImpl extends BaseServiceImpl<OaTaskLog,OaTaskLogDao> implements OaTaskLogService{

	@Override
	public void submitTaskLog(OaTaskLog taskLog, File file, String fileName) {
		// TODO Auto-generated method stub
		Attachment attach = FileUtil.getInstance().createAttach(file, fileName);
		if(attach != null) {
			taskLog.setAttach(attach);
		}
		this.save(taskLog);
	}

	@Override
	public Collection<OaTaskLog> getOaTaskLog(OaTaskSubmit oaTaskSubmit) {
		// TODO Auto-generated method stub
		return this.getDao().getOaTaskLog(oaTaskSubmit);
	}

	@Override
	public Collection<OaTaskLog> getAuditOaTaskLog(Person person) {
		// TODO Auto-generated method stub
		return this.getDao().getAuditOaTaskLog(person);
	}

}
